-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[hist] Improve limits of THLimitsFinder. #19605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Test Results 21 files 21 suites 3d 13h 22m 49s ⏱️ Results for commit 7c7ad25. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks!
I would propose this test:
TTree t;
Float_t x;
t.Branch("x", &x);
x = -999;
t.Fill();
x = 0;
t.Fill();
t.Draw("x");
auto h = (TH1*)gROOT->FindObject("htemp");
ASSERT_EQ(h->GetEntries(), h->GetEffectiveEntries());
@ferdymercury good test! It's added now. |
7c66106
to
18f560e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just a nitpick at the end of DrawAutoBinning:
delete h;
delete gROOT->FindObject("c1");
18f560e
to
e48467f
Compare
👍, updated for h. The canvas isn't created in batch mode, though, so that should be be unnecessary in this test. |
Are you sure?
|
The test failures for the graphics are real. This will require more investigation. |
6397529
to
1a81a93
Compare
99a5fe0
to
28d96e8
Compare
During the merge of histograms with automatic axis ranges, the axis range was computed when the fill buffer of the first histogram is full. In this case, this was about halfway during the merge. The resulting histogram was compared to one whose axis range was computed on the full statistics, leading to slightly different axes. By chance, the differences were within the tolerance, but in the commit to follow, the axis range will be extended slightly to make the maximum of a distribution part of the valid range. This will make the test fail. This commit stabilises the test by extending the fill buffer of the first histogram like for all the others in the test. In this way, all axis ranges are computed on the same data.
- When asking THLimitsFinder to optimise axis limits, ask for a maximum slightly right of the actual maximum of the distribution. Otherwise, since the maximum may coincide with the maximum of the axis range, values may fall into the overflow. - Use std::min / std::max to ensure that OptimizeLimits doesn't truncate any values. - For symmetry reasons, also extend the range slightly to lower values. This fixes the problem observed in https://root-forum.cern.ch/t/bug-or-feature-in-ttree-draw/62862 Co-authored-by: ferdymercury <[email protected]>
9d7e802
to
edc0c7e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much!
THLimitFinder tries to trim empty bins close to the end of an axis range, but sometimes, the min/max was trimmed as well, so not all data would be visible in the histogram. Here, the case from the following post is tested: https://root-forum.cern.ch/t/bug-or-feature-in-ttree-draw/ Co-authored-by: ferdymercury <[email protected]> Co-authored-by: Jonas Rembser <[email protected]>
57121c3
to
7c7ad25
Compare
THLimitsFinder sometimes removes the first/last bin of an axis range. Here, it is ensured that the min and max of a buffered range is part of the axis range, and not removed by accident.
This fixes issues with TTree::Draw such as the one described in https://root-forum.cern.ch/t/bug-or-feature-in-ttree-draw/62862/
This supersedes #17689